 <div class="main-wrap">

        <div class="crumb-wrap">
            <div class="crumb-list"><i class="icon-font"></i><a href="{:U('Index/index')}">首页</a><span class="crumb-step">&gt;</span><span class="crumb-name">我的资源管理</span></div>
        </div>
      <div class="search-wrap">
            <div class="search-content">
                <form action="" method="get">
                    <table class="search-tab">
                        <tr>
                            <td>&nbsp;&nbsp;&nbsp;&nbsp;<a class="btn btn-primary btn2" href="{:U('Pianku/index')}">公共片库</a></td>
                            <td><a class="btn btn-primary btn2"  style="background:#FF9999;" href="{:U('Ziyuan/my')}">私人片库</a></td>
							<td><a class="btn btn-primary btn2"   onclick="datu()" >上传视频</a></td>
                            <th width="120">标题关键词:</th>
                            <td><input class="common-text" placeholder="关键字" name="keywords" value="{$keywords}" id="" type="text"></td>
                            <td><input class="btn btn-primary btn2" name="sub" value="查询" type="submit"></td>
                        </tr>
                    </table>
                </form>
            </div>
        </div>

        <div class="result-wrap">
            <form name="myform" action="{:U('Ziyuan/shanchu')}" id="myform" method="post">
              
                <div class="result-content">
                    <table class="result-tab" width="100%">
                        <tr>
						
						      <th>
							<a id="q1" style="cursor:pointer;" onclick="quanxuan()">全选</a>
							<a style="display:none;cursor:pointer;" id="q2"  onclick="quanbuxuan()">取消全选</a>
							</th>
							
							<script>
						   
						   function quanxuan(){
						   
						     $('input').prop('checked',true);
						     
							 $('#q1').css('display','none');
							  $('#q2').css('display','block');
						   
						   }
						   
						   
						   function quanbuxuan(){
						   
						      $('input').prop('checked',false);
							  
							  	 $('#q2').css('display','none');
							  $('#q1').css('display','block');
						   
						   }
						   
						
						</script>
                           
                            <th>上传时间</th>
                            <th>标题</th>
                          
                            <th>操作</th>
                        </tr>
						
						<foreach name="re" item="v">
						
                        <tr>
                             <td>
                                <input name="ids[]" value="{$v.id}" type="checkbox">
                               
                            </td>
                            <td>{$v.time|date="Y-m-d H:i:s",###}</td>
                            <td>
							   <a onclick="datu1({$v.id})" style="cursor:pointer;">
								{$v.title}
							   </a>
							
							</td>
                          
							<td>
							 <a onclick="add({$v.id})" style="cursor:pointer;">生成链接</a>
							  
							  |
							  
							  <a style="cursor:pointer;" onclick="del({$v.id})">删除</a>
							
							
							</td>
                        </tr>
                        </foreach>
						<tr>
						  <td>
						       <a onclick="shengcheng()" style="cursor:pointer;">批量生成链接</a><br/>
							   <a onclick="shanchu()" style="cursor:pointer;">批量删除链接</a>
						   </td>
						   
						</tr>   
                    </table>
					
					<input type="hidden" name="moshi" id="moshi" />
					
                    <div class="list-page"> {$page}</div>
                </div>
            </form>
        </div>
    </div>
	
	<script>
	
	
	 function shengcheng(){
	 
	      $('#moshi').val(0);
		 
		 $('#myform').submit();
		  
	  
	 
	 }
	
	
	 function shanchu(){
	 
	       $('#moshi').val(1);
		   if(confirm('您确定删除吗')){
		   
			
		   
			 $('#myform').submit();
		   }
	 
	 }
	
	  
	    function datu1(i){
			  layer.open({
				  type: 2,
				  title: '视频详情',
				  shadeClose: true,
				  shade: 0.8,
				  area: ['80%', '90%'],
				  content: '{:U("Pianku/big")}?id='+i //iframe的url
				}); 
			}
	
	
	  function add(i){

	   layer.msg('正在生成链接', {
		  icon: 16
		  ,shade: 0.01,
		  time:20000
		});
			  
	  
	    $.post("{:U('Pianku/add')}",{"id":i},function(re){
		
		     layer.closeAll();
		  
			  if(re==1){
			  
				  layer.alert('生成链接成功,可在我的链接内查看',function(){
				
				  location.reload();
				
				});
			  
			  }else{
			  
				  layer.msg('加入我的片库失败。', {icon: 5});
			  
			  }
			
		
		  })
	    
	  
	  }
	
	  
	  function del(i){
	  
	     if(confirm('您确认要删除吗?')){
		 
		    $.post('{:U("Ziyuan/del")}',{"id":i},function(re){
			
			   if(re==1){
			   
			     alert('删除成功');
			     location.reload();
			   }
			   
			   if(re==3){
			   
			     alert('您不能删除不属于自己的资源');
			   
			   }
			   
			   if(re==2){
			   
			     alert('删除失败');
			   
			   }
			   
			   
			
			})
		 
		 
		 
		 }
	  
	  
	  }
	  
	 
          function datu(i){
			  layer.open({
				  type: 2,
				  title: '添加我的资源',
				  shadeClose: true,
				  shade: 0.8,
				  area: ['80%', '90%'],
				  content: '{:U("Shangchuan/add")}' //iframe的url
				}); 
			}
			
	
	
	</script>
	
	
